Headings

You can make levels of heading in RMarkdown documents using hash

One hash for really big headings

Two hash for smaller

Three for even smaller

So on and so forth

Bold and Italics

You can also make things bold and italics using asteriks on either side of the text. Use two asterisk for bold and 1 asterisk for italics.

I want this to be bold

I want this to be italics

Bullet points

You can also make bullet points with dashes.

Don’t forget to put a space after the dash.

Quotes

You can get quotes to be indented and nicely formatted using >

there is no such thing as a silly question

Pictures/gifs/tweets

You can embed all kinds of things in RMarkdown

Picture use ![](image.png) to add pics from your working directory

Tweets use the embed code

Gifs use the embed code

via GIPHY

What about code?

You can intersperse notes and code “chunks”. R will publish everything in the document as text etc and run the code in each chunk.

Add chunks using the Insert pull down, or use hotkey Ctrl-Alt-I. You can run each chunk of data by pressing the green arrow, or using the same shortcuts you would if you were running code in a script (Ctrl-Shift-Enter)

Play around with chunk settings using the cog

library(tidyverse)
beaches <- read_csv("sydneybeaches.csv")
## Parsed with column specification:
## cols(
##   BeachId = col_double(),
##   Region = col_character(),
##   Council = col_character(),
##   Site = col_character(),
##   Longitude = col_double(),
##   Latitude = col_double(),
##   Date = col_character(),
##   `Enterococci (cfu/100ml)` = col_double()
## )

What happens if we knit that?? It puts code in grey and output in white boxes and everything else is text.

Can we do graphs?

beaches %>%
  group_by(Site) %>%
  summarise(meanbugs = mean(`Enterococci (cfu/100ml)`, na.rm= TRUE)) %>%
  ggplot(aes(x= Site, y= meanbugs)) +
  geom_col() +
  coord_flip()

Looks like swimming at Malabar is not a good idea…

Export formats

The default export format is to html, but you can export to pdf or word by choosing from the pull down menu. Watch out pdf is finickity. You need to have some LaTex (pronounced Lah-Tech) thing also installed.

Try…

install.packages("tinytex")

OK what next…